package com.hnevc.caoliuye;

import java.util.Scanner;
public class Homework {
        public static void main(String[] args) {
            Scanner sc =new Scanner(System.in);
            System.out.println("请输入20个不同的整数(注意整数间用空格)：");//输出整数
            int[] arr=new int[20]; //定义数组的长度为20
            int min = 0,n = 0,m = 0;//
            for (int i = 0; i < arr.length; i++)
                arr[i]=sc.nextInt();
            min=arr[0];
            for (int i = 0; i <arr.length ; i++)
                if (arr[i] < min){
                    min = arr[i];//最小值用min存储
                    n = i;  //此时交换的最小值的下标
                }
            if(n != 0){
                m = arr[n];
                arr[n] = arr[0];
                arr[0] = m;
            }
            for (int a:arr)
                System.out.print(a+" ");
        }
}
